﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using DataAccessClass;

namespace ProducerBO
{
    public class FAQ
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _F_ID = -99;
        private string _F_Q = "";
        private string _F_A = "";
        private bool _ISDELETED = false;
        //private bool _ISACTIVE = true;

        public bool ISDELETED
        {
            get
            {
                return _ISDELETED;
            }
            set
            {
                _ISDELETED = value;
            }
        }
       /* public bool ISACTIVE
        {
            get
            {
                return _ISACTIVE;
            }
            set
            {
                _ISACTIVE = value;
            }
        }*/

        public long F_ID
        {
            get
            {
                return _F_ID;
            }
            set
            {
                _F_ID = value;
            }
        }


        public string F_Q
        {
            get
            {
                return _F_Q;
            }
            set
            {
                _F_Q = value;
            }
        }

        public string F_A
        {
            get
            {
                return _F_A;
            }
            set
            {
                _F_A = value;
            }
        }
        public long SaveRecord()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@F_ID", F_ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@F_Q", F_Q, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@F_A", F_A, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@ISDELETED", ISDELETED, DbType.Boolean, ParameterDirection.Input);
                //DbParameter dbparam4 = DAC.Parameter("@ISACTIVE", ISACTIVE, DbType.Boolean, ParameterDirection.Input);

                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3};
                return DAC.Save("FAQ_SAVE", dbparamcall);
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long F_ID, string F_Q, string F_A, bool ISDELETED, bool ISACTIVE, string andor)
        {
            try
            {

                DbParameter dbparam0 = DAC.Parameter("@F_ID", F_ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@F_Q", F_Q, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@F_A", F_A, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@ISDELETED", ISDELETED, DbType.Boolean, ParameterDirection.Input);
                //DbParameter dbparam4 = DAC.Parameter("@ISACTIVE", ISACTIVE, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@paraandor", andor, DbType.AnsiString, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3,dbparam4};
                DataTable dt = DAC.Select("FAQ_GET", dbparamcall);
                return dt;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }

    }
}
